
package com.jf.cloud.api.product.feign;

import com.jf.cloud.api.product.bo.PlatformCommissionOrderItemBO;
import com.jf.cloud.api.product.dto.CategoryShopDTO;
import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Objects;

/**
 * @author zz
 * @date 2021/5/24
 */
@FeignClient(value = "jfcloud-product",contextId = "category-shop")
public interface CategoryShopFeignClient {


    /**
     * 根据分类，店铺，获取订单项的佣金比例
     * @param platformCommissionOrderItems 订单项平台佣金需要的参数
     * @return 订单项佣金比例
     */
    @PostMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/categoryShop/calculatePlatformCommission")
    ServerResponseEntity<List<PlatformCommissionOrderItemBO>> calculatePlatformCommission(@RequestBody List<PlatformCommissionOrderItemBO>  platformCommissionOrderItems);


    /**
     * 根据店铺id获取有相同分类的供应商
     * @param shopId 店铺id
     * @return 供应商ids
     */
    @PostMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/categoryShop/getSupplierIdsByShopId")
    ServerResponseEntity<List<Long>> getSupplierIdsByShopId(@RequestParam(value = "shopId") Long shopId);

    /**
     * 根据店铺id获取所有分类ids
     * @param shopId 店铺id
     * @param sysType
     * @return 所有分类ids
     */
    @PostMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/categoryShop/getCategoryIdsByShopId")
    ServerResponseEntity<List<Long>> getCategoryIdsByShopId(@RequestParam(value = "shopId") Long shopId,@RequestParam(value = "sysType")  Integer sysType);

    /**
     * 根据店铺id批量保存分类签约信息
     * @param categoryShopDTOList
     * @param shopId
     * @return
     */
    @PostMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/categoryShop/insertBatchByShopId")
    ServerResponseEntity<Void> insertBatchByShopId(@RequestBody List<CategoryShopDTO> categoryShopDTOList, @RequestParam(value = "shopId") Long shopId, @RequestParam(value = "sysType") Integer sysType);

    /**
     * 根据店铺id获取绑定的平台一级分类
     * @param shopId
     * @param lang
     * @param sysType
     * @return
     */
    @PostMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/categoryShop/getOneCategoryIdByShopId")
    ServerResponseEntity<List<Long>> getOneCategoryIdByShopId(@RequestParam("shopId")Long shopId,@RequestParam("sysType") Integer sysType, @RequestParam("lang") Integer lang);

    /**
     * 根据分类id集合获取供应商id
     * @param categoryIds
     * @return
     */
    @PostMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/categoryShop/getSupplyIdByCategoryIds")
    ServerResponseEntity<List<Long>> getSupplyIdByCategoryIds(@RequestBody List<Long> categoryIds);

    /**
     * 根据一级分类id集合获取商家id
     * @param categoryIds
     * @return
     */
    @PostMapping(FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/categoryShop/getShopIdByCategoryIds")
    ServerResponseEntity<List<Long>> getShopIdByCategoryIds(@RequestParam("categoryIds") Object[] categoryIds, @RequestParam("shopIds") Object[] shopIds);

}
